$file1 = "out_HG-U133A_gene_ccds.cdf";
$file2 = "/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/all_scatter.txt";
open(BUFF1,$file1);
open(BUFF2,$file2);
open(WRBUFF1,">/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/genes_5_9.txt");
open(WRBUFF2,">/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/genes_10_12.txt");
open(WRBUFF3,">/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/genes_13_22.txt");
open(WRBUFF4,">/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/genes_23_33.txt");
open(WRBUFF5,">/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/converted_plus2_customcdf_frma/convertedhgu_replicates/3_most_probe/genes_34.txt");
while($line = <BUFF1>)
{
	chomp $line;
	@array = split("\t",$line);	
	 $array[1] =~ s/\t//g;
	$array[1] =~ s/\n//g;
	$array[1] =~ s/\r//g;
	 $array[0] =~ s/\t//g;
        $array[0] =~ s/\n//g;
        $array[0] =~ s/\r//g;

	$hi{$array[0]} = $array[1];
	#print $hi{$array[0]} ."\n";

}
$line = <BUFF2>;
print WRBUFF1 $line;
print WRBUFF2 $line;
print WRBUFF3 $line;
print WRBUFF4 $line;
print WRBUFF5 $line;
while($line = <BUFF2>)
{
	chomp $line;
	@array = split("\t",$line);
	   $array[0] =~ s/\t//g;
        $array[0] =~ s/\n//g;
        $array[0] =~ s/\r//g;
	#print $array[0];
	if($hi{$array[0]} <10 && $hi{$array[0]} >4)
	{
		print WRBUFF1 $line."\n";
	}
	if($hi{$array[0]} <13 && $hi{$array[0]} > 10 )
        {
                print WRBUFF2 $line."\n";
        }
	if($hi{$array[0]} <23 && $hi{$array[0]} > 12 )
        {
                print WRBUFF3 $line."\n";
        }
	if($hi{$array[0]} <34 && $hi{$array[0]} > 22 )
        {
                print WRBUFF4 $line."\n";
        }
	if($hi{$array[0]} > 33 )
        {
                print WRBUFF5 $line."\n";
        }
}
